Merge "rdbms: clean up DBO_TRX behavior for onTransaction* callbacks"
[lhc/web/wiklou.git] / includes / logging / LogEntry.php
index 395110b..c672ef7 100644 (file)
@@ -213,6 +213,30 @@ class DatabaseLogEntry extends LogEntryBase {
                }
        }
 
+       /**
+        * Loads a LogEntry with the given id from database
+        *
+        * @param int $id
+        * @param IDatabase $db
+        * @return DatabaseLogEntry|null
+        */
+       public static function newFromId( $id, IDatabase $db ) {
+               $queryInfo = self::getSelectQueryData();
+               $queryInfo['conds'] += [ 'log_id' => $id ];
+               $row = $db->selectRow(
+                       $queryInfo['tables'],
+                       $queryInfo['fields'],
+                       $queryInfo['conds'],
+                       __METHOD__,
+                       $queryInfo['options'],
+                       $queryInfo['join_conds']
+               );
+               if ( !$row ) {
+                       return null;
+               }
+               return self::newFromRow( $row );
+       }
+
        /** @var stdClass Database result row. */
        protected $row;
 
@@ -761,7 +785,7 @@ class ManualLogEntry extends LogEntryBase {
 
                                        // Log the autopatrol if the log entry is patrollable
                                        if ( $this->getIsPatrollable() &&
-                                               $rc->getAttribute( 'rc_patrolled' ) === 1
+                                               $rc->getAttribute( 'rc_patrolled' ) === 2
                                        ) {
                                                PatrolLog::record( $rc, true, $this->getPerformer() );
                                        }